package eliminate.controller;

import java.awt.EventQueue;
import java.awt.Point;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import eliminate.view.WindowDraggable;
import eliminate.view.login.LoginPanel;
import eliminate.view.register.RegisterPanel;
import eliminate.view.room.RoomChoose;
import eliminate.view.start.MainPanel;

public class MainFrame {
	private static JFrame main_frame;

	public MainFrame() {

	}

	public static void startGame() {
		EventQueue.invokeLater(new Runnable() {
			@Override
			public void run() {
				main_frame = new JFrame();
				main_frame.setUndecorated(true);
				main_frame.setContentPane(new GamePanel());
				main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				main_frame.setSize(912, 513);
				main_frame.setVisible(true);
				WindowDraggable drag = new WindowDraggable();
				main_frame.addMouseListener(drag);
				main_frame.addMouseMotionListener(drag);
				main_frame.setLocationRelativeTo(null);
			}
		});
	}

	public static JFrame getOwner() {
		return main_frame;
	}
	
	
	public static void setContentPanel(JPanel panel){
		main_frame.setContentPane(panel);
		main_frame.revalidate();
	}
	
	public static void setLocation(Point loc){
		main_frame.setLocation(loc);
	}
	
	public static Point getLocation(){
		return main_frame.getLocation();
	}

	public static void main(String[] args) {
		MainFrame.startGame();
	}
	
	public static void showMsgDialog(String msg, String title, int type){
		JOptionPane.showMessageDialog(main_frame, msg, title, 
				type);
	}
}
